<template>
  <div>
    <div class="aui-he"></div>
    <div class="aui-content aui-margin-b-15">
      <auth-form @submit="register" :form_data="form_data" :form_item="form_item"></auth-form>
    </div>
  </div>
</template>

<script>
import { actionTypes } from "@/store/modules/auth";
console.log(actionTypes)
import authForm from '@/components/AuthForm.vue'
export default {
  components:{
    authForm
  },
  data(){
    return{
      form_data:{},
      form_item:[
          {
          icon:'my',
          placeholder:'输入用户名',
          prop:'username',
          type:'text'
        },
        {
          icon:'paper',
          placeholder:'输入邮箱',
          prop:'email',
          type:'text'
        },
        {
          icon:'lock',
          placeholder:'输入密码',
          prop:'password',
          type:'password'
        }
      ]
    }
  },
  methods:{
     register(form){
      this.$store.dispatch(actionTypes.register,form).then(()=>{
        this.$router.replace('/')
      })
    }
  }
};
</script>

<style>
</style>